package com.itheima.controller;

import com.itheima.domain.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.io.IOException;
import java.util.List;

@RequestMapping("/user")
@Controller
@ResponseBody
public class TestCon {
    @Autowired
    private UserService service;
    @RequestMapping("/findAll")
    public List<User> findAll(){
        List<User> all=null;

            all = service.findAll();

        /*ModelAndView modelAndView =new ModelAndView();*/
        System.out.println(all);
        /*modelAndView.addObject("userList",all);
        modelAndView.setViewName("/user.html");*/
        return all;
    }
}
